//
//  AnchorCollectionViewCell.m
//  HimalayaMusic
//
//  Created by dllo on 16/1/8.
//  Copyright © 2016年 WXCLegendary. All rights reserved.
//

#import "AnchorCollectionViewCell.h"

@implementation AnchorCollectionViewCell

-(instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        self.imageViews = [[UIImageView alloc] init];
        self.titleLabel = [[UILabel alloc] init];
        [self addSubview:self.imageViews];
        [self addSubview:self.titleLabel];
    }
    return self;
}

-(void)applyLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes {
    self.imageViews.frame = CGRectMake(5, 5, self.width - 10, (self.height - 10) / 4 * 3);
    self.titleLabel.frame = CGRectMake(self.imageViews.origin.x, self.imageViews.origin.y + self.imageViews.height, self.imageViews.width, (self.height - 10) / 4);
    
}


-(void)setModel:(AnchorModel *)model {
    if (_model != model) {
        _model = model;
    }
    
    [self.imageViews sd_setImageWithURL:[NSURL URLWithString:model.smallLogo]];
    self.titleLabel.text = model.nickname;
    self.titleLabel.textAlignment = NSTextAlignmentCenter;
    self.titleLabel.font = [UIFont systemFontOfSize:12];
}
@end
